<?php
    class MY_Controller extends CI_Controller
    {
        var $user = FALSE;
        protected $base_view = 'view_base';//application.php view
        protected $content_view='';
        protected $view_data = array();
        protected $menu = '';
        protected $submenu='';
        protected $selected_menu='';
        protected $selected_submenu='';
        
        function __construct()
        {
            parent::__construct();
            $this->view_data['title']='Document Management System';
            //$this->session->set_userdata('user_id',8);             
             //$this->user = $this->session->userdata('user_id') ? User::find_by_username($this->session->userdata('user_id')) : FALSE;
             $this->user = $this->session->userdata('user_id') ? User::find($this->session->userdata('user_id')) : FALSE;
             if (!$this->user)
             {
                 redirect(base_url());
                 die();
             }
             
             $this->load->helper('language');
             $this->lang->load('bm');
        }      
        public function ClearContent()
        {
            $this->content_view=''; //don't return content view'

        }
        public function _output($output)       //$output contains all html to output
        {
            if ( $this->content_view !='') 
            {

                $yield = $this->load->view($this->content_view,$this->view_data,TRUE);
                        
                 if ($this->base_view)
                    echo $this->load->view($this->base_view,array('yield'=> $yield),TRUE);
                else
                    echo $yield;
             }   
                
        }
    }
?>